package com.solo.system.mapper;

import com.mybatisflex.core.query.QueryChain;
import com.solo.common.core.base.mapper.BasicMapper;
import com.solo.system.api.entity.SysDictType;
import org.apache.ibatis.annotations.Mapper;

import static com.solo.system.api.entity.table.SysDictTypeTableDef.SysDictTypeTable;

/**
 * 字典类型Mapper接口
 * @author 十一
 * @since 2023/09/22 16:08
 * 人生若只如初见，何事秋风悲画扇
 **/
@Mapper
public interface SysDictTypeMapper extends BasicMapper<SysDictType> {

    /**
     * 按代码查询字典类型
     * @param code 代码
     * @return {@link SysDictType }
     */
    default SysDictType selectByCode(String code) {
        return QueryChain.of(this)
                .where(SysDictTypeTable.Code.eq(code))
                .one();
    }

}
